# Contributor: Hoang Nguyen <folliekazetani@protonmail.com>
# Maintainer: Hoang Nguyen <folliekazetani@protonmail.com>
pkgname=kubefwd
pkgver=1.22.3
pkgrel=0
pkgdesc="Bulk port forwarding Kubernetes services"
url="https://github.com/txn2/kubefwd"
arch="all"
license="Apache-2.0"
makedepends="go"
subpackages="
	$pkgname-bash-completion
	$pkgname-zsh-completion
	$pkgname-fish-completion
	"
source="$pkgname-$pkgver.tar.gz::https://github.com/txn2/kubefwd/archive/refs/tags/$pkgver.tar.gz"

build() {
	go build -v -tags netgo -o bin/$pkgname \
		-ldflags "-X main.Version=$pkgver" \
		./cmd/kubefwd/kubefwd.go
	./bin/kubefwd completion bash > kubefwd.bash
	./bin/kubefwd completion zsh > kubefwd.zsh
	./bin/kubefwd completion fish > kubefwd.fish
}

check() {
	go test ./...
}

package() {
	install -Dm755 bin/$pkgname "$pkgdir"/usr/bin/$pkgname

	install -Dm644 kubefwd.bash \
		"$pkgdir"/usr/share/bash-completion/completions/kubefwd
	install -Dm644 kubefwd.zsh \
		"$pkgdir"/usr/share/zsh/site-functions/_kubefwd
	install -Dm644 kubefwd.fish \
		"$pkgdir"/usr/share/fish/completions/kubefwd.fish
}

sha512sums="
cc92979400836deacf99477ae6f8b686903d17b7bce3282a3d52e2bb94a111ffec321436b885c1e60c809f100e052ea9611ee484f2820d83dacc2c7491eb1cdc  kubefwd-1.22.3.tar.gz
"
